Public Class cls_Logfile_Update
    Inherits cls_Database_Base
#Region "Get data"
    Public Function FuncG_GetData() As DataTable
        Dim mvDataTale As New DataTable
        Dim mvStr_Sql As String = ""
        Try
            If FuncM_OpenConnection() Then
                mvStr_Sql = "SELECT * FROM TBL_LOGFILE ORDER BY [ID] DESC"
                mvDataTale = FuncM_GetDataTable(mvStr_Sql)
            End If
        Catch ex As Exception
            Throw ex
        Finally
            FuncM_CloseConnection()
        End Try
        Return mvDataTale
    End Function
    Public Function FuncG_GetData(ByVal iDat_FromDate As Date, ByVal iDat_ToDate As Date) As DataTable
        Dim mvDataTale As New DataTable
        Dim mvStr_Sql As String = ""
        Try
            If FuncM_OpenConnection() Then
                mvStr_Sql = "SELECT * FROM [TBL_LOGFILE] WHERE DATEADD(day, 0, DATEDIFF(day, 0, CREATED)) BETWEEN @iDTm_FROMDATE AND @iDTm_TODATE ORDER BY [ID] DESC"
                SubM_AddParameter("@iDTm_FROMDATE", iDat_FromDate)
                SubM_AddParameter("@iDTm_TODATE", iDat_ToDate)
                mvDataTale = FuncM_GetDataTable(mvStr_Sql)
            End If
        Catch ex As Exception
            Throw ex
        Finally
            FuncM_CloseConnection()
        End Try
        Return mvDataTale
    End Function
#End Region
#Region "Insert"
    Public Function FuncG_Insert(ByVal iCls_Logfile As cls_Logfile) As Boolean
        Try
            If FuncM_OpenConnection() Then
                SubM_AddParameter("@iNVchr_USERNAME", iCls_Logfile.UserName)
                SubM_AddParameter("@iNVchr_DETAIL", iCls_Logfile.Detail)
                If FuncM_ExecuteStore("usp_Logfile") Then
                    Return True
                Else
                    Return False
                End If
            End If
        Catch ex As Exception
            Throw ex
            Return False
        Finally
            FuncM_CloseConnection()
        End Try
    End Function
#End Region
#Region "Delete"
    Public Function FuncG_Delete(ByVal iDat_FromDate As Date) As Boolean
        Dim mvStr_Sql As String = ""
        Try
            If FuncM_OpenConnection() Then
                mvStr_Sql = "DELETE TBL_LOGFILE WHERE DATEADD(day, 0, DATEDIFF(day, 0, CREATED)) <= @iDTm_FROMDATE"
                SubM_AddParameter("@iDTm_FROMDATE", iDat_FromDate)
                If FuncM_ExecuteNonQuery(mvStr_Sql) Then
                    Return True
                Else
                    Return False
                End If
            End If
        Catch ex As Exception
            Throw ex
            Return False
        Finally
            FuncM_CloseConnection()
        End Try
    End Function
#End Region
End Class
